package cn.yanhu.kuwanapp.welfare.ad

import android.content.Context
import cn.yanhu.kuwanapp.utils.Config
import cn.yanhu.kuwanapp.welfare.ad.csj.CsjAdProcess
import cn.yanhu.kuwanapp.welfare.ad.csj.TTAdManagerHolder
import cn.yanhu.kuwanapp.welfare.ad.gdt.GdtAdProcess
import com.qq.e.comm.managers.GDTADManager

/**
 *广告平台工厂类
 *@author woochen
 *@time 2019-12-16 15:14
 */
object AdPlatformFactory {

    fun init(context: Context) {
        TTAdManagerHolder.init(context)
        GDTADManager.getInstance().initWith(context.applicationContext, Config.YLH_APP_ID)
    }

    /**
     * 获取广告平台实例
     * @param platformType 默认为1，优量汇 2,穿山甲
     */
    fun getAdPlatformInstance(platformType: Int): IAdProcess? {
        var adPlatform: IAdProcess? = null
        when (platformType) {
            AdPlatformType.GDT -> {
                adPlatform = GdtAdProcess()
            }
            AdPlatformType.CSJ -> {
                adPlatform = CsjAdProcess()
            }
        }
        return adPlatform
    }
}